home *** CD-ROM | disk | FTP | other *** search
- program Project1;
-
- {$apptype console}
-
- uses
- SysUtils,
- AARegex in 'AARegex.pas';
-
- var
- P : TaaRegexParser;
- RC : TaaRegexCompiler;
- i : integer;
- S : string;
- F : text;
- ec : TaaRegexError;
- begin
- (*
- S := '(a*[a-z]+)|g?[(ab';
- P := TaaRegexParser.Create(S);
- if not P.Parse(i) then begin
- writeln('error found at ', i);
- writeln(S);
- for i := 1 to length(S) do
- write(i mod 10);
- writeln;
- end;
- P.Free;
- readln;
- *)
- // S := '([a-zA-Z]+\^)|([A-Za-z]+\.[A-Za-z])';
- // S := '.*(true|false);[ ]*$';
- // S := '^ *(function|procedure) +[^.]*$';
- // S := 'if.*then( *| begin *)$';
- // S := 'while.*do( *| begin *)$';
- // S := '^[^ A-Z]*$';
- // S := '^( *|.*:= *)rcSetState';
- S := '\{(.+)+\}';
- // S := '\{.+\}';
- RC := TaaRegexCompiler.Create(S);
- if not RC.Parse(i, ec) then begin
- writeln('error found at ', i);
- writeln(S);
- for i := 1 to length(S) do
- write(i mod 10);
- writeln;
- end
- else begin
- RC.IgnoreCase := true;
- System.Assign(F, 'AARegEx.pas');
- System.Reset(F);
- while not eof(F) do begin
- readln(F, S);
- i := RC.MatchString(S);
- if (i <> 0) then
- writeln(i:2, ' ', S);
- end;
- System.Close(F);
- end;
- RC.Free;
- readln;
- end.
-